package testrj.comparator;

import rjson.Rjson;
import rjson.printer.Printer;
import rjson.transformer.AbstractTransformer;

public class ObjectIncludeNoDateComparator {
	public boolean objectsIgnoringAllDateFieldsAreSameAs(Object object1, Object object2) {
		Rjson rjson = Rjson.newInstance().with(new DateTransformer());
		String object1Json = rjson.toJson(object1);
		String object2Json = rjson.toJson(object2);
		return object1Json.equals(object2Json);
	}
}

class DateTransformer extends AbstractTransformer {
	public boolean canHandle(Object object) {
		if (object instanceof java.util.Date)
			return true;
		return false;
	}

	public void transform(Object object, Printer printer, Rjson rjson) {
		printData(null, printer);
	}
}